<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
    <meta charset="UTF-8">
    <title>ceshi</title>
    <script src="../js/angular-1.5.6.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" charset="utf-8">
        var app = angular.module('myApp', []);
        app.controller('siteCtrl', function($scope, $http) {
            $http.get("http://localhost:8080/users/2")
                    .success(function (res) {
                        $scope.names = res;}
            );
        });
        app.controller('save', function($scope, $http) {

            $scope.saveUser = {
                id:null,
                uname:'',
                unumber:null
            };
            $scope.getUser = function(){
                $http({
                    method: "post",
                    url: "http://localhost:8080/users",
                    data: $scope.saveUser
                }).success(function (date){
                    // handle success
                })
            };
        });
    </script>
</head>
<body>
<table class="table">
    <div ng-controller="siteCtrl">
        <ul>
            <li >
                id:{{names.id}}
            </li>
            <li >
                名字：{{names.uname}}
            </li>
            <li >
                学号：{{names.unumber}}
            </li>
        </ul>

    </div>


    <div ng-controller="save">
        <form novalidate>
            <p>ID</p>
            <input type="text" ng-model="saveUser.id">
            <br>
            <p>Name</p>
            <input  type="text" ng-model="saveUser.uname">
            <br>
            <p>age</p>
            <input  type="text" ng-model="saveUser.unumber">
            <br>
            <button ng-click="getUser()">提交</button>
        </form>
    </div>
</table>
</body>
</html>